using System;

namespace SharpMud.MudLib.SAMPLE.Net.SessionStates
{
	public class PutInWorld : SessionStateBase
	{
		public PutInWorld()
		{
		}
		public override string StateID
		{
			get
			{
				return "PutInWorld";
			}
		}
		public override void Pulse()
		{
			if(StillActive)
			{
				if(Session.CurrentCharacter.Location == null)
					Session.CurrentCharacter.Location = new SharpMud.MudLib.SAMPLE.Environment.RoomID(0,null);

				MudLib.SAMPLE.Environment.Room r = MudServer.EnvironmentSystem.GetRoom(Session.CurrentCharacter.Location);
				Session.CurrentCharacter.Initialize(MudServer.PlayerSystem.Players);
				r.RegisterCharacterHere(Session.CurrentCharacter);
				MudServer.PlayerSystem.RegisterPlayerPlaying(Session.CurrentCharacter);
				
				Session.SessionState.Clear();
				Session.SessionState.Push(new SessionStates.GamePlayPrompt());
				this.SetInactive();
			}
		}
	}
}